<!DOCTYPE html> 
<html>
	<head>

  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>激活记录</title>
  <meta name="viewport" content="initial-scale=1, maximum-scale=1">
  <!-- <link rel="shortcut icon" href="http://favicon.ico"> -->
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="viewport" content="width=device-width, height=device-height, user-scalable=no, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0">


		
  <link rel="stylesheet" href="https://gitee.com/huaflower/ReadBook_CommonFile/raw/master/css/sm.min.css">
  <link rel="stylesheet" href="https://gitee.com/huaflower/ReadBook_CommonFile/raw/master/css/sm-extend.min.css">
  <script type="text/javascript" src="https://gitee.com/huaflower/ReadBook_CommonFile/raw/master/common/common/common.js"></script>
	</head>
	<body>
		
		<div class="page-group">
			<div class="page">
				<!--标题-->
				
				<section class="content infinite-scroll infinite-scroll-bottom" data-distance="0">
					<article class="list-block media-list" style="margin:0">
						<ul class="list-container">
							<!-- <li class="item-content">
								<div class="item-inner">
									<div class="item-title-row">
										<div class="item-title">问题少女</div>
										<div class="item-after">2018-06-13 12:23:51</div>
									</div>
									<div class="item-subtitle">凯特琳</div>
									<div class="item-text">非常有问题</div>
								</div>
							</li> -->
						</ul>						
					</article>
					<!--加载提示符-->
					<!-- <article class="infinite-scroll-preloader">
						<div class="preloader"></div>
					</article> -->
				</section>
			</div>
		</div>
		
		 <!-- !-- 固定的js引用，所有的jQuery 要用 $$ 表示 --> -->
<script type="text/javascript" src="https://gitee.com/huaflower/ReadBook_CommonFile/raw/master/js/js/jquery-1.11.1.min.js"></script>
<!-- 这一行代码是为了 避免js冲突 -->
<script type="text/javascript">var $$ =jQuery.noConflict();</script>

<script type='text/javascript' src='https://gitee.com/huaflower/ReadBook_CommonFile/raw/master/zepto/zepto/zepto.min.js' charset='utf-8'></script>
<script type='text/javascript' src='https://gitee.com/huaflower/ReadBook_CommonFile/raw/master/js/js/sm.min.js' charset='utf-8'></script>
<!-- <script type='text/javascript' src='https://gitee.com/huaflower/CommonFile/raw/master/js/sm-extend.min.js' charset='utf-8'></script> -->
<script src="https://gitee.com/huaflower/ReadBook_CommonFile/raw/master/js/js/swiper/swiper.min.js"></script>
		<script>
			var loading = false;	//加载中
			var startIndex = 0;	//开始加载的条目数
			var arrData = [];	//获取的到数据
			var limit = 10; //每次加载 10个条目
			var devicecode = "";//设备号


			function getParams(data){
			 // data需要转成json调用 ，函数urlParamParseJson();
			   /*var jodata = JSON.parse(data); 
			   if(isNotNull(jodata)){//
			   }*/

			   if(isNotNull(data)){
			      devicecode = data;
			      addItem();
			   }
			}

			
			// $(document).on('infinite','.infinite-scroll-bottom',function(){
			// 	//$('.infinite-scroll-preloader').css('display','block');
			// 	if(loading){
			// 		return;
			// 	}
			// 	loading = true; //加载完毕

			// 	addItem();
			// 	$.refreshScroller(); //刷新滚动
			// });
			
			//动态请求数据
			function addItem() {
				var params = {
						callbacktype:'history'
				    }

				    //网络请求框架，需要传入成功函数回调和 失败函数回调
				    net_request('get','apis/history?device='+devicecode,params,successCallBack,errorCallBack);
			}

			  //成功的回调函数
			  	function successCallBack(data){
			    	// isNotNull() 用来判断字段不为空
			    	var html = '';
			      	if(isNotNull(data)){
			         	console.log(data);
						if(isNotNull(data.data)&&data.data.length>0){
							arrdata = data.data;
							for(var e=0;e<arrdata.length;e++){
								var name= "";
								var activated_at ="";
								if(isNotNull(arrdata[e].name)){
									name = arrdata[e].name;
								}
								
								if(isNotNull(arrdata[e].activated_at)){
									activated_at = arrdata[e].activated_at;
								}
								
								html += `<li class="item-content">
								<div class="item-inner">
									<div class="item-title-row">
										<div class="item-title">${name}</div>
									</div>
									<div class="item-subtitle">激活设备的编码：${devicecode}</div>
									<div class="item-text">${activated_at}</div>
								</div>
							</li>`;

							}

							startIndex = arrData.length;
							$$('.list-container').html(html);
							
							// $('.infinite-scroll-preloader').remove();
							/*if (strdata.length < count) {
				                  // 加载完毕，则注销无限加载事件，以防不必要的加载
				                  // $.detachInfiniteScroll($('.infinite-scroll'));
				                  // 删除加载提示符
				                  $('.infinite-scroll-preloader').remove();
				                  return;
				            }*/
						}else{
							// $('.infinite-scroll-preloader').remove();
						}
			      	}
			  	}

			// 	失败的回调函数
			  	function errorCallBack(data){
			    	console.log(data);
			  	}
			
			//初始化
			$(function(){
				$.init();
			});
		</script>
	</body>
</html>